home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Magazine / PC2Amiga / Samba / examples / printing / smbprint.sysv < prev   
Text File  |  1996-05-03  |  2KB  |  53 lines

  1. #!/bin/sh
  2. #
  3. # @(#) smbprint.sysv version 1.0 Ross Wakelin <r.wakelin@march.co.uk>
  4. #
  5. #      Version 1.0 13 January 1995
  6. #        modified from the original smbprint (bsd) script
  7. #
  8. # this script is a System 5 printer interface script. It 
  9. # uses the smbclient program to print the file to the specified smb-based 
  10. # server and service. 
  11. # To add this to your lp system, copy this file into your samba directory 
  12. # (the example here is /opt/samba), modify the server and service variables 
  13. # and then execute the following command (as root) 
  14. #
  15. # lpadmin -punixprintername -v/dev/null -i/opt/samba/smbprint 
  16. # where    unixprintername is the name that the printer will be known as 
  17. # on your unix box. 
  18. # the script smbprint will be copied into your printer administration 
  19. # directory (/usr/lib/lp or /etc/lp) as a new interface 
  20. # (interface/unixprintername)
  21. # Then you have to enable unixprintername and accept unixprintername
  22. #
  23. # This script will then be called by the lp service to print the files
  24. # This script will have 6 or more parameters passed to it by the lp service.
  25. # The first five will contain details of the print job, who queued it etc,
  26. # while parameters 6 onwards are a list of files to print.  We just
  27. # cat these at the samba client.
  28. #
  29. # Set these to the server and service you wish to print to 
  30. # In this example I have a WfWg PC called "lapland" that has a printer 
  31. # exported called "printer" with no password.
  32. #
  33. # clear out the unwanted parameters
  34. shift;shift;shift;shift;shift
  35. # now the argument list is just the files to print
  36.  
  37. server=admin
  38. service=hplj2
  39. password=""
  40.  
  41. (
  42. # NOTE You may wish to add the line `echo translate' if you want automatic
  43. # CR/LF translation when printing.
  44.        echo translate
  45.     echo "print -"
  46.     cat $*
  47. ) | /opt/samba/smbclient "\\\\$server\\$service" $password -N -P  > /dev/null
  48. exit $?
  49.  
  50.